草庐IT

Module not found: Error: Package path 找不到模块

全部标签

javascript - RequireJS 模块的 TypeScript 编译生成行 Object.defineProperty(exports, "__esModule", { value : true }); How to get rid of it?

这是我的tsconfig.json文件的样子:{"compileOnSave":true,"compilerOptions":{"module":"amd","noImplicitAny":false,"removeComments":false,"preserveConstEnums":true,"strictNullChecks":true,"sourceMap":false}}我有一个名为a.ts的typescript文件,它是一个AMD模块(我正在使用requirejs),它看起来像:exportfunctiona(){vara={b:5};returna;}编译后的Javas

javascript - Node |模块.js :540 throw err

所以这是我编写的第一个程序,但是当我在控制台中运行它时出现此错误。module.js:540throwerr;^Error:Cannotfindmodule'C:\Users\Daniel\Desktop\app'atFunction.Module._resolveFilename(module.js:538:15)atFunction.Module._load(module.js:468:25)atFunction.Module.runMain(module.js:684:10)atstartup(bootstrap_node.js:187:16)atbootstrap_node.j

javascript - 安装 React Native map 。在 UIManager 中找不到 AIRMap

可能有几个人问过这个问题,我一直在Github上寻找,但找不到适用于安装ReactNativeMaps的解决方案...InvariantViolation:requireNativeComponent:"AIRMap"wasnotfoundintheUIManager.Thiserrorislocatedat:inAIRMap(atMapView.js:760)inMapView(atHome.js:118)"react-native":"^0.57.0-rc.4","react-native-maps":"^0.21.0",我试过:rm-rfiosandroidnode_module

javascript - glslify 如何在模块之间共享结构

我正在使用https://github.com/glslify/glslify在glsl着色器之间共享代码。我有一个vert着色器,它试图在vert的顶部包含一个模块:#pragmaglslify:JointAndPalette=require('./JointAndPalette.glsl');#pragmaglslify:decodeJointAndPalette=require('./decodeJointAndPalette.glsl');JointAndPalettejointAndPalette=decodeJointAndPalette(inputProps);decod

javascript - 火狐: "Error loading script"

如果我“快速单击”网站上的不同链接(Asp.NetMVC+jQuery,完整回发),FireFox3会出现“加载脚本错误”。重现此错误是相当容易的任务。但我不明白为什么会这样?每次它显示不同的失败脚本文件。所有JavaScript文件都包含在结束标记之前。错误被捕获在window.onerror处理程序中。如果我只是忽略消息“错误加载脚本”的错误,一切正常。但这似乎不是最好的解决办法,一定是有原因的。很遗憾,这篇文章对我没有帮助:Firefox‘Errorloadingscript’loadingGoogleAnalyticsinFF2另一个描述类似问题的资源:BrowserScrip

javascript - 如何模块化javascript?

我有两个网页(a.php和b.php)。它们具有非常相似的逻辑但不同的UI。我写了两个javascript。它们看起来像:aUI={displayMessage=function...showDetails=function...}functionfoo(){aUI.displayMessage();aUI.showDetails();//andotherthingsaboutaUI.displayMessage()andaUI.showDetails()...}foo();aUI.displayMessage()与bUI.displayMessage()不同。但是a.js和b.js有

Javascript: 'require' 是 AMD 中的同步方法(异步模块定义)吗?

'require'在AMD(异步模块定义)中是同步的吗?如果是这样,是什么使该规范异步?如果我的代码中间有require()(它还没有被加载),它会停止执行吗?会说话的浏览器端。 最佳答案 这里有两个不同的synchronous概念。第一个是“它会停止我的整个网页,坐等文件吗?”。答案是否定的。如果您有一个具有依赖项的脚本,RequireJS不会这样做。如果使用得当,它会使用promise系统。这意味着如果您发送回调并定义对该文件的要求,则在加载所有必需的文件之前不会运行回调。如果其中一个必需文件中有require,则THAT回调将

javascript - 当在当前对象中找不到对象时,Mustache js 会采用父对象范围

根据mustacheRFCA{{name}}taginabasictemplatewilltrytofindthenamekeyinthecurrentcontext.Ifthereisnonamekey,nothingwillberendered.因此我期望这样:vartemplate='{{#anArray}}{{aString}}{{/anArray}}';varjson={"aString":"ABC","anArray":[1,{"aString":"DEF"}]};渲染后给我:"DEF"然而,mustache.js在父级范围内查找值。这给了我"ABCDEF"上下文是否真的意

javascript - 调试显示模块模式 : functions not in scope until called?

如果我在Chrome开发者工具中运行这段代码:vartest=(function(){varpublicFunction,privateFunction1,privateFunction2;privateFunction1=functionprivateFunction1(){returntrue;};privateFunction2=functionprivateFunction2(){returntrue;};publicFunction=functionpublicFunction(){privateFunction1();debugger;};return{publicFunc

javascript - 是否可以检测脚本是否作为 RequireJS 模块加载?

我正在研究是否有一种方法可以确定检测给定脚本当前是否正在被RequireJS加载。一般来说,AMD模块的答案会更好,但我的用例只是RequireJS。jQuery和其他库像这样“检测”它:if(typeofdefine==="function"&&define.amd){define("jquery",[],function(){returnjQuery;});}在大多数情况下这就足够了,但问题是它不检测脚本是否作为AMD模块加载,它只检测define是否存在并支持AMD规范。有没有一种方法,无论是使用RequireJS还是一般的AMD模块,让脚本确定(真正地)它是否作为模块加载?